﻿using System;
using System.Collections.Generic;
using System.Text;
using Catalina.Common;

namespace Catalina.Dal
{
	class CatalinaLabelMapper : MapperBase<CatalinaLabel>
	{
		protected override CatalinaLabel Map(System.Data.IDataRecord record)
		{
			try
			{
				String upc = FromDB<string>(record["upc"]);
				String description = FromDB<String>(record["item_name"]);
				String requirements = FromDB<string>(record["qualifier"]);
				String incentive = FromDB<string>(record["reward"]);
				int locAisle = FromDB<int>(record["locAisle"]);
				int locBlock = FromDB<int>(record["locBlock"]);
				int locSeq = FromDB<int>(record["locSeq"]);
				DateTime endDate = FromDB<DateTime>(record["end_date"]);

				return new CatalinaLabel(upc, description, requirements, incentive, locAisle, locBlock, locSeq, endDate);
			}
			catch
			{
				throw;
			}
		}
	}
}
